package GUI;
import Buildings.Buildings;
import Interfaces.*;
import Buildings.dwelling.*;
import Buildings.office.*;
import javax.swing.*;
import java.awt.Component.*;
import java.awt.*;

public class BuildingPanel extends javax.swing.JPanel {

    private Building bild;
    public BuildingPanel(Building b, BFrame bf) {
        bild=b;
        initComponents();
        this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
        int from,to;
        from=bild.getHowMuchSpaceInBuilding();
        for(int i=bild.getHowMuchFloorInBuilding();i>0;i--){
            to=from;//не включая
            from=to-(b.getFloor(i-1).getHowMuchSpaceInFloor());//вкл
            this.add(new FloorPanel(b.getFloor(i-1),i-1,bf,from));
        }
        this.setVisible(true);
    }
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setAutoscrolls(true);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
